package com.eblacorp.archive.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileUtil {
	public static byte[] getBytes(File file){
		FileInputStream is;
	    byte[] bytes = null;
	    int fileLength = (int)file.length();
	    if(fileLength != 0)
	    {
	    	try
	    	{
	    		is = new FileInputStream(file);
	    		bytes = new byte[fileLength];
	    		is.read(bytes);
	    		is.close();
	    	}
	    	catch (FileNotFoundException e)
	    	{
	    		e.printStackTrace();
	    	}
	    	catch (IOException e)
	    	{
	    		e.printStackTrace();
	    	}
	    }
	    return bytes;
    }
}
